<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Kiểm tra trạng thái sách</title>
<script>
function checkstatus(){
	var titleid = document.getElementById("titleid").value;
	if ((titleid == "") || (titleid == null)){
		alert("Bạn chưa nhập mã sách");
	}
		
	else {
		var xmlhttp;

		if (window.XMLHttpRequest)
		  {// code for IE7+, Firefox, Chrome, Opera, Safari
		  xmlhttp=new XMLHttpRequest();
		  }
		else
		  {// code for IE6, IE5
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		xmlhttp.onreadystatechange=function()
		  {
			 if ((xmlhttp.readyState==4) && (xmlhttp.status == 200)){
				 //alert(xmlhttp.responseText);
					document.getElementById('check').innerHTML = xmlhttp.responseText; 
			 }
		  };
		
		var query = "?titleid="+titleid;
		xmlhttp.open("GET","/librarysystem/CheckBookStatus"+query,true);
		xmlhttp.send();		
	}
}
</script>
</head>
<body>
<jsp:include page="librarianmenu.jsp" />

<br>
<br>

  <table width="558" border="0">
    <tr>
      <td width="120">Mã tiêu đề sách :</td>
      <td width="33"><input type="text" name="booktitleid" id="titleid" /></td>
      <td width="144"><label>
      <button value="check now" onclick="checkstatus()">Check Now</button>
      </label></td>
    </tr>
  </table>
  
  <div id="check"></div>
  <p><br />
  </p>
  <br>

<%@include file="/searchtool.html" %> 
</body>
</html>